<?php
/**
 * 咖啡馆模块
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2017/12/22
 * Time: 14:56
 */

namespace App\Http\Controllers\MiniProgram;

use App\Cafe;
use App\Http\Logics\MiniProgram\CafeLogic;
use App\Http\Traits\CafeTrait;
use App\Http\Controllers\BaseController;
class CafeController extends BaseController
{
    use CafeTrait;

    /**
     * @SWG\Post(
     *     path="/cafe/create",
     *     tags={"Cafe"},
     *     description="创建咖啡馆",
     *     operationId="createCafe",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *      @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="name",
     *         in="query",
     *         description="咖啡馆名称",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="address",
     *         in="query",
     *         description="咖啡馆地址",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="latlng",
     *         in="query",
     *         description="经纬度坐标",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="photo_list_str",
     *         in="query",
     *         description="咖啡馆图片列表字符串",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="form_id",
     *         in="query",
     *         description="",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function createCafe()
    {
        $name = $this->name;
        $address = $this->address;
        $latlng = $this->latlng;
        $photo_list_str = $this->photo_list_str;
        $loginSession = $this->loginSession;
        $form_id = $this->form_id;

        $data = [
            'name' => $name,
            'address' => $address,
            'latlng' => $latlng,
            'photo_list_str' => $photo_list_str,
            'loginSession' => $loginSession,
            'form_id' => $form_id
        ];

        $response = CafeLogic::createCafe($data);

        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response(0,'',$response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/nearby",
     *     tags={"Cafe"},
     *     description="获取附近咖啡馆",
     *     operationId="nearbyCafe",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥(登陆后需要传该参数)",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="lat",
     *         in="query",
     *         description="咖啡馆纬度",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="lng",
     *         in="query",
     *         description="咖啡馆经度",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function nearbyCafe()
    {
        $loginSession = $this->loginSession;
        $lat = $this->lat;
        $lng = $this->lng;
        $limit = $this->limit;

        // 获取到经纬度字符串
        $latlng = latlng($lat, $lng);

        // 通过经纬度获取到城市的citycode
        $response = CafeLogic::getCitycodeByGps($latlng);
        if ($response->code){
            return $this->response($response->code);
        }
        $citycode = $response->data;

        // 筛选条件
        $data = [
            'loginSession' => $loginSession,
            'status' => Cafe::ONLINE,
            'citycode'=> $citycode,
            'limit' => $limit
        ];

        // 获取该城市上线的所有咖啡馆
        $response = CafeLogic::getCafeList($data);
        if ($response->code){
            return $this->response($response->code);
        }
        $cafe = $response->data;

        // 将附近的咖啡馆筛选出来
        $response = CafeLogic::getCafeByDistance($cafe, $lat, $lng, Cafe::DISTANCE);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, ['current_page' => 1, 'last_page' => 1, 'data' => $response->data]);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/info",
     *     tags={"Cafe"},
     *     description="获取某一个咖啡馆信息",
     *     operationId="getCafeInfo",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeInfo()
    {
        $loginSession = $this->loginSession;
        $data = [
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::getCafe($data);
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/recommend",
     *     tags={"Cafe"},
     *     description="获取推荐咖啡馆列表",
     *     operationId="recommend",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥(登陆后需要传该参数)",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function recommend()
    {
        $loginSession = $this->loginSession;
        $limit = $this->limit;
        $data = [
            'loginSession' => $loginSession,
            'limit' => $limit,
            'star' => 5
        ];
        $response = CafeLogic::recommend($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/detail",
     *     tags={"Cafe"},
     *     description="获取某一个咖啡馆详情",
     *     operationId="getCafeDetail",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeDetail()
    {
        $loginSession = $this->loginSession;
        $cafe_id = $this->cafe_id;
        $data = [
            'loginSession' => $loginSession,
            'cafe_id' => $cafe_id
        ];
        $response = CafeLogic::getCafeDetail($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/getLatestList",
     *     tags={"Cafe"},
     *     description="获取最新的咖啡馆列表",
     *     operationId="getLatestCafeList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥(登陆后需要传该参数)",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getLatestCafeList()
    {
        $loginSession = $this->loginSession;
        $limit = $this->limit;
        $data = [
            'loginSession' => $loginSession,
            'limit' => $limit,
            'status' => 1
        ];
        $response = CafeLogic::getLatestCafeList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/getListByMarkId",
     *     tags={"Cafe"},
     *     description="getCafeListByMarkId",
     *     operationId="通过标签ID获取咖啡馆列表",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥(登陆后需要传该参数)",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="mark_id",
     *         in="query",
     *         description="标签ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeListByMarkId()
    {
        $loginSession = $this->loginSession;
        $mark_id = $this->mark_id;
        $limit = $this->limit;
        $data = [
            'loginSession' => $loginSession,
            'mark_id' => $mark_id,
            'limit' => $limit,
            'status' => Cafe::ONLINE
        ];
        $response = CafeLogic::getCafeListByMarkId($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/getWifi",
     *     tags={"Cafe"},
     *     description="获取咖啡馆wifi信息",
     *     operationId="getCafeWifi",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="key",
     *         in="query",
     *         description="合作者key",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeWifi()
    {
        $key = $this->key;
        $data = [
            'key' => $key
        ];
        $response = CafeLogic::getCafeWifi($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/createPoster",
     *     tags={"Cafe"},
     *     description="创建咖啡馆海报",
     *     operationId="createCafePoster",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function createCafePoster()
    {
        $cafe_id = $this->cafe_id;
        $data = [
            'cafe_id' => $cafe_id
        ];
        $response = CafeLogic::createCafePoster($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/getLogo",
     *     tags={"Cafe"},
     *     description="获取推荐的咖啡馆LOGO",
     *     operationId="getCafeLogo",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeLogo()
    {
        $limit = $this->limit;
        $data = [
            'limit' => $limit,
            'show_logo' => 1,
            'status' => 1
        ];
        $response = CafeLogic::getCafeLogo($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/list",
     *     tags={"Cafe"},
     *     description="获取咖啡馆列表",
     *     operationId="getCafeList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="name",
     *         in="query",
     *         description="咖啡馆名称",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="citycode",
     *         in="query",
     *         description="城市编码",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="mark_id_str",
     *         in="query",
     *         description="标签ID列表字符串",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="adcode",
     *         in="query",
     *         description="区域编码",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeList()
    {
        $name = $this->name;
        $limit= $this->limit;
        $citycode = $this->citycode;
        $mark_id_str = $this->mark_id_str;
        $adcode = $this->adcode;
        $loginSession = $this->loginSession;
        $data = [
            'name' => $name,
            'status' => Cafe::ONLINE,
            'limit' => $limit,
            'citycode' => $citycode,
            'mark_id_str' => $mark_id_str,
            'adcode' => $adcode,
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::getCafeList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/everydayRecommend",
     *     tags={"Cafe"},
     *     description="获取每日推荐咖啡馆",
     *     operationId="getEverydayRecommend",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="date",
     *         in="query",
     *         description="日期",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getEverydayRecommend()
    {
        $date = $this->date;
        $data = [
            'date' => $date
        ];
        $response = CafeLogic::getEverydayRecommend($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    public function getRecommendList()
    {
        $date = $this->date;
        $limit = $this->limit;
        $data = [
            'date' => $date,
            'limit' => $limit
        ];
        $response = CafeLogic::getRecommendList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/update",
     *     tags={"Cafe"},
     *     description="更新咖啡馆详情信息",
     *     operationId="updateCafe",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="latlng",
     *         in="query",
     *         description="咖啡馆经纬度",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="address",
     *         in="query",
     *         description="咖啡馆详细地址",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="logo",
     *         in="query",
     *         description="咖啡馆LOGO",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="since_year",
     *         in="query",
     *         description="咖啡馆创办时间",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="name",
     *         in="query",
     *         description="咖啡馆名称",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="open_time",
     *         in="query",
     *         description="咖啡馆开门时间",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="close_time",
     *         in="query",
     *         description="咖啡馆打样时间",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="outside_time",
     *         in="query",
     *         description="咖啡馆例外营业时间",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="day_off",
     *         in="query",
     *         description="咖啡馆店休时间",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="mobile",
     *         in="query",
     *         description="咖啡馆联系方式",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="summary",
     *         in="query",
     *         description="咖啡馆联简介",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cover",
     *         in="query",
     *         description="咖啡馆封面",
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updateCafe()
    {
        $loginSession = $this->loginSession;
        $cafe_id = $this->cafe_id;
        $latlng = $this->latlng;
        $address = $this->address;
        $logo = $this->logo;
        $since_year = $this->since_year;
        $name = $this->name;
        $open_time = $this->open_time;
        $close_time = $this->close_time;
        $outside_time = $this->outside_time;
        $day_off = $this->day_off;
        $mobile = $this->mobile;
        $summary = $this->summary;
        $cover = $this->cover;
        $data = [
            'cafe_id' => $cafe_id,
            'latlng' => $latlng,
            'address' => $address,
            'logo' => $logo,
            'since_year' => $since_year,
            'name' => $name,
            'open_time' => $open_time,
            'close_time' => $close_time,
            'outside_time' => $outside_time,
            'day_off' => $day_off,
            'mobile' => $mobile,
            'summary' => $summary,
            'cover' => $cover,
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::updateCafe($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/photo",
     *     tags={"Cafe"},
     *     description="获取咖啡馆的所有图片",
     *     operationId="getCafePhoto",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafePhoto()
    {
        $cafe_id = $this->cafe_id;
        $data = [
            'cafe_id' => $cafe_id
        ];
        $response = CafeLogic::getCafePhoto($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/updatePhoto",
     *     tags={"Cafe"},
     *     description="更新咖啡馆图片",
     *     operationId="updateCafePhoto",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="photo_list_str",
     *         in="query",
     *         description="活动图片列表字符串",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updateCafePhoto()
    {
        $cafe_id = $this->cafe_id;
        $photo_list_str = $this->photo_list_str;
        $loginSession = $this->loginSession;
        $data = [
            'cafe_id' => $cafe_id,
            'photo_list_str' => $photo_list_str,
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::updateCafePhoto($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }


    /**
     * @SWG\Post(
     *     path="/cafe/updateMark",
     *     tags={"Cafe"},
     *     description="更新咖啡馆标签",
     *     operationId="updateCafeMark",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="mark_id_str",
     *         in="query",
     *         description="标签ID字符串",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updateCafeMark()
    {
        $cafe_id = $this->cafe_id;
        $mark_id_str = $this->mark_id_str;
        $data = [
            'cafe_id' => $cafe_id,
            'mark_id_str' => $mark_id_str
        ];
        $response = CafeLogic::updateCafeMark($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/createVideo",
     *     tags={"Cafe"},
     *     description="设置咖啡馆视频",
     *     operationId="createCafeVideo",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="url",
     *         in="query",
     *         description="视频地址",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function createCafeVideo()
    {
        $cafe_id = $this->cafe_id;
        $url = $this->url;
        $loginSession = $this->loginSession;
        $data = [
            'cafe_id' => $cafe_id,
            'url' => $url,
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::createCafeVideo($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/getVideoList",
     *     tags={"Cafe"},
     *     description="设置咖啡馆视频",
     *     operationId="getCafeVideoList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="cafe_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getCafeVideoList()
    {
        $cafe_id = $this->cafe_id;
        $limit = $this->limit;
        $data = [
            'cafe_id' => $cafe_id,
            'limit' => $limit
        ];
        $response = CafeLogic::getCafeVideoList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/updateVideo",
     *     tags={"Cafe"},
     *     description="更新咖啡馆视频",
     *     operationId="updateCafeVideo",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="video_id",
     *         in="query",
     *         description="咖啡馆ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="url",
     *         in="query",
     *         description="视频地址",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function updateCafeVideo()
    {
        $video_id = $this->video_id;
        $url = $this->url;
        $data = [
            'video_id' => $video_id,
            'url' => $url
        ];
        $response = CafeLogic::updateCafeVideo($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Post(
     *     path="/cafe/deleteVideo",
     *     tags={"Cafe"},
     *     description="删除咖啡馆视频",
     *     operationId="deleteCafeVideo",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="video_id",
     *         in="query",
     *         description="视频ID",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function deleteCafeVideo()
    {
        $video_id = $this->video_id;
        $data = [
            'video_id' => $video_id
        ];
        $response = CafeLogic::deleteCafeVideo($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/cafe/recent",
     *     tags={"Cafe"},
     *     description="获取最近几天上线的咖啡馆",
     *     operationId="getRecentCafe",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=false,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="day_num",
     *         in="query",
     *         description="天数",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getRecentCafe()
    {
        $day_num = $this->day_num;
        $loginSession = $this->loginSession;
        $data = [
            'day_num' => $day_num,
            'loginSession' => $loginSession
        ];
        $response = CafeLogic::getRecentCafe($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}